{% extends 'base.html' %}
{% block title %}Brisbane Coupon{% endblock %}
{% block stylesheet %}
{{ block.super }}
{% endblock%}

{% block javascript %}
{{ block.super }}
{% endblock%}

{% load thumbnail %}

{% block content %}
<h3><a href="{{ event.murl }}">{{ event.name }}</a> | <a href="{{ event.store.murl }}">{{ event.store }}</a></h3>
<hr />
<strong>{{ event.sdate|date:"D d M" }} - {{ event.edate|date:"D d M" }}</strong>
<p>
{{ event.description|safe }}
</p>

<!-- 
<button id="kakao" data-inline="true">kakao</button>
<a href="{% url mkakao %}" data-role="button" data-inline="true" data-rel="dialog">Kakao</a>
 --> 

 
{% if not event.get_coupon_status %}
<a href="#" data-role="button" data-inline="true" data-rel="dialog">쿠폰이 없는 이벤트입니다.</a>
{% else %}
{% ifequal event.get_coupon_status "PAST" %}
<a href="#" data-role="button" data-inline="true" data-rel="dialog">이벤트 기간이 끝났습니다.</a>
{% else %}
<a href="{% url mcoupon event.id %}" data-role="button" data-inline="true" data-rel="dialog">모바일쿠폰받기({{ event.get_coupon_status }})</a>
{% endifequal %}
{% endif %}

{% thumbnail event.detail "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}

{% if event.image1 %}
{% thumbnail event.image1 "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
{% endif %}

{% if event.image2 %}
{% thumbnail event.image2 "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
{% endif %}

{% if event.image3 %}
{% thumbnail event.image3 "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
{% endif %}


<div data-role="collapsible" data-content-theme="c">
  <h3>Similar Events</h3>
  <p>
    <ul>
      {% for e in event.get_similar_events %}
      <li>
        <a href="{{ e.murl }}">{{ e.name }}</a>
      </li>
      {% empty %}
      <li>유사한 이벤트가 없습니다.</li>
      {% endfor %}
    </ul>
  </p>
</div>

<div data-role="collapsible" data-content-theme="c">
  <h3>Similar Stores</h3>
  <p>
    <ul>
      {% for s in event.get_similar_stores %}
      <li>
        <a href="{{ s.murl }}">{{ s.name }}</a></li>
      {% empty %}
      <li>유사한 Store가 없습니다.</li>
      {% endfor %}
    </ul>
  </p>
</div>

<div data-role="collapsible" data-content-theme="c">
  <h3>Near Stores</h3>
  <p>
    <ul>
      {% for s in event.get_near_stores %}
      <li>
        <a href="{{ s.murl }}">{{ s.name }}</a>
      </li>
      {% empty %}
      <li>가까운 거리에 Store가 없습니다.</li>
      {% endfor %}
    </ul>
  </p>
</div>

<script type="text/javascript" src="{{ STATIC_PREFIX }}js/m/kakaoLink.js"></script>
<script type="text/javascript">

$("#kakao").click(function(){
    kakao.link("talk").send({
        msg : "카카오링크를 사용하여 메세지를 전달해보세요.;",
        url : "http://link.kakao.com",
        appid : "m.kakao.com",
        appver : "2.0",
        appname : "카카오",
        metainfo : JSON.stringify({metainfo : [ {os:"android", devicetype: "phone",installurl:"market://details?id=com.kakao.talk", executeurl : "kakaoagit://testtest"},{os:"ios", devicetype:"pad",installurl:"items://itunes.apple.com/us/app/kakaotalk/id362057947?mt=8",executeurl : "kakaoagit://testtest"}]}),
        type : "app"
    });
});
</script>


{% endblock %}
